package com.tie.catalogo;

import java.util.ArrayList;

import models.Goods;
import adapters.CuadriculaAdapter;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.GridView;

public class Fragment_VistaCuadricula extends Fragment{
	
	GridView gv;
	ArrayList<Goods> goods;
	View vista;
	
	public Fragment_VistaCuadricula(ArrayList<Goods>goods) {
		// TODO Auto-generated constructor stub
		this.goods = goods;
	}
	
	public Fragment_VistaCuadricula() {
		// TODO Auto-generated constructor stub
	}
	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		//Como el setContet View
		vista = inflater.inflate(R.layout.fragment_cuadricula, container, false);
		gv = (GridView)vista.findViewById(R.id.gridView1);
		loadGrid();
		return vista;
	}
	public void loadGrid(){
		this.goods = goods;
		//Cargar datos en el CustomAdapter
		CuadriculaAdapter adapter = new CuadriculaAdapter(getActivity().getApplicationContext(), goods);
		gv.setAdapter(adapter);
	}
}
